package com.rightin.reader.hf;

import java.util.Timer;
import java.util.TimerTask;

/* loaded from: hf_reader.jar:com/rightin/reader/hf/MyTimer.class */
public class MyTimer {
    private boolean _Enabled;
    private int _Interval;
    private Timer timer1;
    private String tagName;
    private OnTimerTickListener timeListener;

    /* loaded from: hf_reader.jar:com/rightin/reader/hf/MyTimer$OnTimerTickListener.class */
    public interface OnTimerTickListener {
        void onTick(String str);
    }

    public String getTagName() {
        return this.tagName;
    }

    public void setTagName(String tagName) {
        this.tagName = tagName;
    }

    public void setOnTimerTickListener(OnTimerTickListener _timeListener) {
        this.timeListener = _timeListener;
    }

    public MyTimer() {
        this._Interval = 100;
    }

    public MyTimer(String tagName) {
        this._Interval = 100;
        this.tagName = tagName;
    }

    public MyTimer(int paramInt) {
        this._Interval = 100;
        this._Interval = paramInt;
    }

    public void start() {
        if (this.timer1 != null) {
            this.timer1.cancel();
        }
        this.timer1 = new Timer();
        this.timer1.schedule(new TimerTask() { // from class: com.rightin.reader.hf.MyTimer.1
            @Override // java.util.TimerTask, java.lang.Runnable
            public void run() {
                if (MyTimer.this.timeListener != null) {
                    MyTimer.this.timeListener.onTick(MyTimer.this.tagName);
                }
            }
        }, this._Interval, this._Interval);
        this._Enabled = true;
    }

    public void stop() {
        if (this.timer1 != null) {
            this.timer1.cancel();
        }
        this._Enabled = false;
    }

    public boolean getEnabled() {
        return this._Enabled;
    }

    public int getInterval() {
        return this._Interval;
    }

    public void setEnabled(boolean paramBoolean) {
        this._Enabled = paramBoolean;
        if (paramBoolean) {
            start();
        } else {
            stop();
        }
    }

    public void setInterval(int paramInt) {
        this._Interval = paramInt;
    }
}
